package com.FOD.fragments;

import com.FOD.clases.R;
import com.FOD.entities.PacienteUsuario;
import com.FOD.entities.User;
import com.FOD.util.SessionDBHandler;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class ViewProfilePatientFragment extends Fragment {
	View rootView;
	SessionDBHandler db;
	TextView nickname_view;
	TextView name_view;
	TextView mail_view;
	TextView age_view;
	TextView sex_view;
	TextView dependency_view;
	TextView sport_view;
	TextView phone_view;
	TextView create_date_view;

	TextView ocupation_view;
	TextView civil_state_view;
	TextView smoking_view;
	TextView school_view;
	TextView dominancia_view;
	TextView alcohol_view;
	User mUser = new User();
	PacienteUsuario mPatient = new PacienteUsuario();

	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		rootView = inflater.inflate(R.layout.view_profile_patient, container, false);
		db = new SessionDBHandler(rootView.getContext());

		nickname_view = (TextView)rootView.findViewById(R.id.nickname_view);
		name_view = (TextView)rootView.findViewById(R.id.name_view);
		mail_view = (TextView)rootView.findViewById(R.id.mail_view);
		age_view = (TextView)rootView.findViewById(R.id.age_view);
		sex_view = (TextView)rootView.findViewById(R.id.sex_view);
		dependency_view = (TextView)rootView.findViewById(R.id.dependency_view);
		sport_view = (TextView)rootView.findViewById(R.id.sport_view);
		phone_view = (TextView)rootView.findViewById(R.id.phone_view);
		create_date_view = (TextView)rootView.findViewById(R.id.create_date_view);

		ocupation_view = (TextView)rootView.findViewById(R.id.ocupation_view);
		civil_state_view = (TextView)rootView.findViewById(R.id.civil_state_view);
		smoking_view = (TextView)rootView.findViewById(R.id.smoking_view);
		school_view = (TextView)rootView.findViewById(R.id.school_view);
		dominancia_view = (TextView)rootView.findViewById(R.id.dominancia_view);
		alcohol_view = (TextView)rootView.findViewById(R.id.alcohol_view);

		mUser = db.getUserDetails();
		nickname_view.setText("Nickname: "+mUser.getNickname());
		name_view.setText("Nombre: "+mUser.getName());
		mail_view.setText("Correo: "+mUser.getMail());
		age_view.setText("Edad: "+String.valueOf(mUser.getAge()));
		sex_view.setText("Sexo: "+mUser.getConverterSexToString(mUser.getSex(), rootView.getContext()));
		dependency_view.setText("Dependencia: "+mUser.getDependecy());
		sport_view.setText("Deporte: "+mUser.getSport());
		phone_view.setText("Telefono: "+String.valueOf(mUser.getPhone()));

		mPatient = db.getPatientUserDetails();
		ocupation_view.setText("Ocupacion: " + mPatient.getOcupacion());
		civil_state_view.setText("Estado civil: " + mPatient.getConverterCivilStatenToString(mPatient.getEstadoCivil(), rootView.getContext()));
		smoking_view.setText("Tabaquismo: " + ((mPatient.isTabaquismo()) ? "Si" : "No") );
		school_view.setText("Escolaridad: " + mPatient.getConverterStudiesToString(mPatient.getEscolaridad(),rootView.getContext()));
		dominancia_view.setText("Dominancia: " + mPatient.getDominancia());
		smoking_view.setText("Alcoholismo: " + ((mPatient.isAlcoholismo()) ? "Si" : "No") );

		return rootView;
	}

}
